package org.poker.swing;

import java.awt.Dialog;
import java.awt.Dimension;

import javax.swing.JInternalFrame;

public class Resolution {

	private int x;
	private int y;
	
	private int sizeX;
	private int sizeY;

	
	public Resolution(Frame frame, int dX, int dY, int percentX, int percentY) {
		Dimension d = frame.getToolkit().getScreenSize();
		
		x = Math.round((d.width - dX) / 2); // largura
		y = Math.round((d.height - dY) / 2); // altura		
		
		sizeX = (d.width * percentX) / 100;
		sizeY = (d.height * percentY) / 100;
	}
	
	/**
	 * 
	 * @param dialog
	 * @param dX
	 * @param dY
	 */
	public Resolution(Dialog dialog, int dX, int dY) {
		Dimension d = dialog.getToolkit().getScreenSize();

		x = Math.round((d.width - dX) / 2); // largura
		y = Math.round((d.height - dY) / 2); // altura		
		
	}

	/**
	 * 
	 * @param frame
	 * @param dX
	 * @param dY
	 */
	public Resolution(Frame frame, int dX, int dY) {
		Dimension d = frame.getToolkit().getScreenSize();
		
		x = Math.round((d.width - dX) / 2);
		y = Math.round((d.height - dY) / 2);
	}

	/**
	 * 
	 * @param jInternalFrame
	 * @param dX
	 * @param dY
	 */
	public Resolution(JInternalFrame jInternalFrame, int dX, int dY) {
		Dimension d = jInternalFrame.getToolkit().getScreenSize();

		x = Math.round((d.width - dX) / 2);
		y = Math.round((d.height - dY) / 2);
	}
	
	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public int getSizeX() {
		return sizeX;
	}

	public int getSizeY() {
		return sizeY;
	}
}